<template>
	<view class="pad20">
		<view class="bank-view border-rad20">
			<radio-group @change="radioChange">
				<label class="radio-list uni-list-cell-pd radio-font" v-for="(item, index) in bankList" :key="index">
					<view class="view-left">{{index == 0 ?'到账银行卡':''}}</view>
					<view class="view-center">{{item.name}}</view>
					<view class="view-right">
						<radio :value="item.id" :checked="item.id === bankId" />
					</view>
				</label>
			</radio-group>
				
			<view class="flex-cc uni-list-cell-pd border-b" @tap="navTo('../addBank/addBank')">
				<view class="qxicon iconadd add-font">
					添加银行卡
				</view>
			</view>	
			<!-- 输入框 -->
			<view class="border-b pad20">
				<view class="">
					提现金额
				</view>
				<view class="input-view flex-cfs">
					<text>¥</text>
					<input type="number" value="" v-model="inputVal" placeholder=""/>
				</view>
			</view>
			
			<view class="pad20">
				<view class="">
					余额 ￥5530
				</view>
				<view class="">
					<button class="sub-but" :class="bankId>0&&inputVal>0?'':'ban-but'" type="primary"
					@tap="withdrawal">提现</button>
				</view>
				
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bankId:0,
				inputVal:0||'',
				bankList:[
					{id:'1',name:'建设银行',wh:2222,img:''},
					{id:'2',name:'建设银行',wh:2352,img:''},
					{id:'3',name:'招商银行',wh:1582,img:''}
				]
			}
		},
		methods: {
			navTo:function(url){
				uni.navigateTo({
					url
				});
			},
			radioChange(e){
				console.log(e.target.value)
				this.bankId = e.target.value;
			},
			withdrawal(e){
				if(this.bankId > 0 && this.inputVal > 0){
					uni.showToast({
						title:  this.inputVal+"元,提现成功!", 
					})
					this.inputVal = '';
				}
			}
		}
	}
</script>

<style>
	.bank-view{
		background-color: #FFFFFF;
	}
	.radio-list{
		
		position: relative;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}
	.view-left,.view-center,.view-right{
		width: 33.3%;
	}
	.view-left{
		
	}
	.view-center{
		text-align: center;
	}
	.view-right{
		text-align: right;
	}
	
	.radio-font{
		font-size:28upx;
		font-weight:500;
		color:rgba(60,60,60,1);
		line-height:40upx;
	}
	.add-font{
		font-size:28upx;
		font-weight:500;
		color:rgba(180,180,180,1);
		line-height:40upx;
	}
	
	
	.input-view{
		font-size:72upx;
		font-weight:600;
		color:rgba(60,60,60,1);
		line-height:100upx;
	}
	.input-view input{
		padding-left: 20upx;
		font-size:72upx;
	}
	.sub-but{
		margin-top: 80upx;
		width:400upx;
		height:80upx;
		border-radius:40upx;
	}
	.allow-but{
		
	}
	.ban-but{
		background:rgba(180,180,180,1);
	}
	
	
</style>
